﻿using System.Linq;
using System.Xml.Serialization;
using ElectronicCommerce.Framework.Configuration.Attributes;

namespace ElectronicCommerce.Framework.Web.Configuration.StringResource.Help
{
    /// <summary>
    /// Help Category Collection
    /// </summary>
    [ConfigFile("~/Language/zh-cn/HelpCategory.config", ConfigPathType.ServerPath)]
    [XmlRoot("helpCategoryConfig", Namespace = "http://www.ElectronicCommerce.com/Language")]
    public class HelpCategoryResourceConfiguration
    {
        [XmlElement("category")]
        public HelpCategoryCollection HelpCategoryCollection
        {
            get;
            set;
        }

        public HelpCategory GetHelpCategoryById(int id)
        {
            return HelpCategoryCollection.Where(cate => cate.Id == id).SingleOrDefault<HelpCategory>();
        }
    }
}
